/**
 * 验证XSD类
 */
package com.flute.framework.util;

import java.io.File;

import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.SchemaFactory;

/**
 * @author Jazz
 *
 */
public class XMLValidByXSD {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
		    SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema")
		        .newSchema(new File("D:\\workspace\\new_lily\\config\\lily.xsd")).newValidator()
		            .validate(new StreamSource("D:\\workspace\\new_lily\\config\\test.xml"));
		    System.out.println("验证成功");
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println("验证失败");
		}
	}

}
